<!--<?php
include_once PrintEot('left');
print <<<EOT
-->
<script src="js/date.js" language="JavaScript"></script>
<div class="nav3 mb10">
    <ul id="basictype" class="cc">
        <li class="current"><a href="$basename" hidefocus="true">图片管理</a></li>
    </ul>
</div>
<form method="post" action="$basename">
  <input type="hidden" value="search" name="action">
  <h2 class="h1">图片搜索</h2>
  <div class="admin_table mb10">
  <table width="100%" cellspacing="0" cellpadding="0">
    <tbody><tr class="tr1 vt">
      <td class="td2">
      	<span class="mr20">楼盘名称:<input type="text" class="input" value="$name" name="name"></span>
      	<span class="mr20">图片描述:<input type="text" class="input" value="$descrip" name="descrip"></span>
      	<span class="mr20">图片分类:<select name="typeid" >
	<option value="0"></option>
<!--
EOT;
foreach ($topTypes as $key => $top) {
$selected = $key==$typeid ? 'selected="selected"':'';
print <<<EOT
-->
    <option $selected value="$key">$top[name]</option>
<!--
EOT;
if($secendTypes[$key]){
foreach ($secendTypes[$key] as $k=>$secend) {
$selected = $k==$typeid ? 'selected="selected"':'';
print <<<EOT
-->
	<option $selected value="$k">&nbsp; &nbsp;|-$secend[name]</option>
<!--
EOT;
}}print <<<EOT
-->
<!--
EOT;
}print <<<EOT
-->
</select></span>
      	<span class="mr20">发表日期:<input type="text" class="input" onclick="javascript:ShowCalendar(this.id)" id="crtime_s" value="$starttime" name="starttime">
        -
        <input type="text" class="input" onclick="javascript:ShowCalendar(this.id)" value="$endtime" id="crtime_e" name="endtime">
        </span>
		<span class="mr20"><span class="btn"><span><button value="搜索" type="submit">搜索</button></span></span></span>
      
      </td>

    </tr>
    
  </tbody></table>
  </div>

</form>
<style>
.admin-img li{float:left;width:150px;height:210px;line-height:16px;}
.admin-img li .height-limit{height:17px; overflow:hidden;}
.admin-img li img{width:100px;height:100px;padding:5px;border:1px solid #ccc;background:#fff;}
</style>
<!--
EOT;
if ($action=='search') {print <<<EOT
-->
<!--
EOT;
if ($images) {print <<<EOT
-->
<form action="$basename" method="post">
<input type="hidden" name="name" value="$name" >
<input type="hidden" name="descrip" value="$descrip" >
<input type="hidden" name="typeid" value="$typeid" >
<input type="hidden" name="starttime" value="$starttime" >
<input type="hidden" name="endtime" value="$endtime" >
<input type="hidden" name="action" value="deleteimages" >
<div class="mb10">
<h2 class="h1"><span class="fl">搜索结果</span><span class="fr">[共{$totalCount}条结果]</span></h2>
<ul class="admin-img tac cc" style="margin-top:5px">
<!--
EOT;
foreach ($images as $key => $image) {print <<<EOT
-->
		<li id="image_{$image[id]}">
			<a href="index.php?m=house&q=image&id={$image[id]}" target="_blank">
				<img src="$image[mini]" border="0" class="vphoto" title="$image[name]"/>
			</a>
			<p id="typename_{$image[id]}"> 类型：$image[typename]</p>
			<p id="descrip_{$image[id]}" class="height-limit">&nbsp;$image[descrip]</p>
			<p>$image[uploadtime]</p>
			<p>
			<span class="mr10">
				<a href="#" onclick="editImage('$image[id]',this);" >
					[编辑]
				</a>
			</span>
			<span class="mr10">
				<a href="#" onclick="delImage('$image[id]');">
					[删除]
				</a>
			</span>
			</p>
			<p>选中 <input type="checkbox" name="select[]" value="$image[id]"></p>
		</li>
<!--
EOT;
}print <<<EOT
-->
</ul>

</div>
<div class="mt10 cc">$pages</div>
<div class="mb10 tac">
	<span class="bt"><span><button onfocus="blur();" onclick="selectAll('select[]')" type="button">全选</button></span></span>
	<span class="btn"><span><button type="submit" onfocus="blur();"  onclick="return confirm('是否确认该操作？')">删除</button></span></span>
</div>
</form>
<!--
EOT;
}else{print <<<EOT
-->
<div class="mb10" id="legend">
    <div class="legend">
        <ul>
            <li>没有找到相关图片</li>
        </ul>
    </div>
</div>
<!--
EOT;
}print <<<EOT
-->
<script src="js/pw_ajax.js" language="JavaScript"></script>
<script src="js/global.js" language="JavaScript"></script>
<script language="javascript">
function editImage(id,o) {
	var url = "$ajax_basename";
	read.obj = o;
	ajax.send(url,'type=editimage&id='+id,ajax.get);
}
function editImaged(id) {
	var rText = ajax.request.responseText.split("|");
	if (rText[0] == 'success') {
		var typename = document.getElementById('typename_'+id);
		typename.innerHTML = '类型：'+ rText[1];
		var descrip = document.getElementById('descrip_'+id);
		descrip.innerHTML = ' '+ rText[2];
	} else {
		ajax.guide();
	}
}
function delImage(id){
	if (!confirm("确定要删除此图片吗？")){
		return false;
	}
	var url = "$ajax_basename";
	ajax.send(url,'type=deleteimage&id='+id,function(){
		var rText = ajax.request.responseText.split("|");
		if (rText[0] == 'success') {
			var element = document.getElementById('image_'+id);
			if (element) {
				showDialog('success','操作成功!',1);
				element.parentNode.removeChild(element);
			} else {
			}
		} else {
			ajax.guide();
		}
	});
}

~
function () {
	var ischeck = 'checked';
	selectAll = function (name) {
		var temp = document.getElementsByName(name);
		if (temp.length < 1) return null;
		for (var i=0 ; i<temp.length;i++) {
			temp[i].checked = ischeck;
		}
		ischeck = ischeck ? false : 'checked';
	}
}()
</script>
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->